package com.yaj.mesif.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.yaj.mesif.dto.TiBlptDto;
import com.yaj.mesif.entity.TiBlpt;
import com.yaj.mesif.mapper.TiBlptMapper;
import com.yaj.mesif.service.TiBlptService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wei
 * @since 2021-08-18
 */
@Service
public class TiBlptServiceImpl extends ServiceImpl<TiBlptMapper, TiBlpt> implements TiBlptService {
    @Resource
    private TiBlptMapper tiBlptMapper;

    @Override
    public boolean RegTiBlpt(TiBlptDto tiBlptDto) {
        TiBlpt tiBlpt = new TiBlpt();
        BeanUtil.copyProperties(tiBlptDto,tiBlpt);

        //取-前的订单号
        String orderNo = tiBlpt.getOrderNo().split("-")[0];
        tiBlpt.setOrderNo(orderNo);

        int result = tiBlptMapper.insert(tiBlpt);
        if (result == 1) {
            return true;
        }
        return false;
    }
}
